import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleFunction;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class streamTest {
    public static void main(String[] args) throws FileNotFoundException {


//        Map<String, Long> freq;
//        Stream<String> words = new Scanner(new File("C:\\Users\\jyy\\Desktop\\1.txt")).tokens();
//        freq = words.collect(Collectors.groupingBy(String::toLowerCase, Collectors.counting()));
//        System.out.println(freq);
//
//        addDouble(1D, 2D, (a, b) -> {
//            System.out.println(a + b);
//            return a;
//        });

        List<Integer> numbers = Arrays.asList(3, 2, 2, 3, 7, 3, 5);
// 获取对应的平方数
        List<Integer> squaresList = numbers.stream().map( i -> i*i).distinct().collect(Collectors.toList());

        System.out.println(squaresList);


    }

    public static void addDouble(Double a, Double b, DoubleBinaryOperator doubleBinaryOperator) {
        doubleBinaryOperator.applyAsDouble(a, b);
    }


}
